package com.baofu.paycore.service.factory.impl;

import com.baofu.paycore.manager.model.withdraw.WithdrawBO;
import com.baofu.paycore.service.facade.model.PayBaseDTO;
import com.baofu.paycore.service.factory.OrderFactory;
import com.baofu.paycore.service.factory.PayBaseFactory;
import com.baofu.paycore.service.processor.PayBaseProcessor;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 *  提现单 组装工厂类
 *
 * <p>
 *  1. 组装提现模型
 * </p>
 * User: xin deng  Date: 16/6/3 ProjectName: paycore Version: 1.0
 */
@Service
public class WithdrawFactoryImpl extends PayBaseFactory implements OrderFactory {

    /**
     * 主单处理器
     */
    @Resource(name = "withdrawProcessor")
    private PayBaseProcessor commonProcessor;

    /**
     * 资金单处理器
     */
    @Resource(name = "withdrawFundProcessor")
    private PayBaseProcessor fundProcessor;

    /**
     * 银行单
     */
    @Resource(name = "withdrawBankProcessor")
    private PayBaseProcessor bankProcessor;

    /**
     * 初始化
     */
    @PostConstruct
    public void init(){
        processor.add(commonProcessor);
        processor.add(fundProcessor);
        processor.add(bankProcessor);
    }
    /**
     * 组装提现模型
     *
     * @param baseDTO   请求对象
     * @return          提现模型
     */
    @Override
    public WithdrawBO build(PayBaseDTO baseDTO) {
        WithdrawBO withdrawBO = new WithdrawBO();
        super.buildBO(withdrawBO, baseDTO);
        return withdrawBO;
    }
}
